<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script type="text/javascript">
description("Test if it doesn't crash when reloading while WebSocket is busy");

window.jsTestIsAsync = true;

var frameDiv;
var reloadCount = 0;

document.iframeReady = function ()
{
    if (reloadCount == 0)
        debug("PASS iframe is ready.");
    else if (reloadCount == 1) {
        debug("PASS reloaded iframe while WebSocket is busy");
        finishJSTest();
    } else
        testFailed("iframe should not get reloaded more than once. (reloadCount = " + reloadCount + ")");
    return reloadCount++;
};

frameDiv = document.createElement("iframe");
frameDiv.src = "resources/reload-crash-iframe.html";
document.body.appendChild(frameDiv);
debug("PASS insert a iframe");

</script>
</body>
</html>
